Skip to content

chore: add tests #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

chore: add tests #31

wants to merge 5 commits into from

Conversation

RoseSecurity
Copy link

@RoseSecurity RoseSecurity commented Jun 20, 2025

What

  • Add basic component test
  • Add disabled component test
  • Test component drifting
  • Add any additional use case tests

Why

  • Test basic component features
  • Verify that the component does not create any resources when input enabled: false set
  • Verify that the component does not drift on a second run with the same inputs
  • Add test for any additional than basic use cases for the component

References

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive automated component tests for ElastiCache Redis, including scenarios for enabled and disabled configurations.
    • Added multiple YAML fixture files for VPC, DNS, account mapping, and Redis test scenarios to support robust testing.
    • Provided an example Atmos CLI configuration and vendor manifest for Terraform components.
  • Documentation

    • Expanded the test directory README with detailed setup instructions and dependency requirements.
  • Chores

    • Added Go module and dependency management files for the test suite.
    • Introduced a .gitignore to exclude generated and cache files from version control.
  • Bug Fixes

    • Set a default value for ingress_cidr_blocks to prevent undefined behavior.
  • Refactor

    • Removed obsolete test script (run.sh) to streamline the test directory.

Copy link

coderabbitai bot commented Jun 20, 2025

Walkthrough

This update introduces a comprehensive test suite for an ElastiCache Redis Terraform component, including new Go-based tests, extensive YAML configuration fixtures, and documentation. It adds dependency management files, a .gitignore, and removes an obsolete shell script. Additionally, a Terraform variable receives a default value adjustment.

Changes

File(s) Change Summary
src/variables.tf Added a default empty list to the ingress_cidr_blocks variable.
test/README.md Expanded with detailed instructions, dependencies, and test execution steps.
test/component_test.go New Go test suite for ElastiCache Redis, including setup, deployment, validation, and cleanup logic.
test/go.mod Added Go module file with direct and indirect dependencies, and a replace directive.
test/.gitignore New file to ignore state, cache, test results, and configuration artifacts.
test/run.sh Deleted obsolete shell script.
test/fixtures/atmos.yaml New Atmos CLI configuration fixture with paths, logging, and templating options.
test/fixtures/vendor.yaml New vendor manifest for vendoring Terraform components from GitHub sources.
test/fixtures/stacks/catalog/account-map.yaml New fixture defining a Terraform account-map component with static backend for tests.
test/fixtures/stacks/catalog/dns-delegated.yaml New fixture for a dns-delegated Terraform component with zone configuration.
test/fixtures/stacks/catalog/dns-primary.yaml New fixture for a dns-primary Terraform component with domain and record settings.
test/fixtures/stacks/catalog/usecase/basic.yaml New fixture for a basic ElastiCache Redis component setup.
test/fixtures/stacks/catalog/usecase/disabled.yaml New fixture for a disabled ElastiCache Redis component configuration.
test/fixtures/stacks/catalog/vpc.yaml New fixture for a VPC Terraform component with metadata and variable settings.
test/fixtures/stacks/orgs/default/test/_defaults.yaml New org-level defaults including backend, variables, and account mapping.
test/fixtures/stacks/orgs/default/test/tests.yaml Aggregates multiple test fixtures for the default organization stack.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner as Go TestRunner
    participant Helper as Test Helper Suite
    participant Terraform as Terraform CLI
    participant AWS as AWS Cloud

    TestRunner->>Helper: Initialize ComponentSuite
    Helper->>Terraform: Deploy dependencies (vpc, dns-delegated)
    Helper->>Terraform: Deploy elasticache-redis/basic
    Terraform->>AWS: Provision resources
    Helper->>Terraform: Validate deployment
    Helper->>Terraform: Drift test
    Helper->>Terraform: Destroy resources (deferred cleanup)
    Helper->>Terraform: Deploy elasticache-redis/disabled (enabled: false)
    Terraform->>AWS: (No resources created)
    Helper->>Terraform: Validate 'enabled' flag behavior
    Helper->>Terraform: Destroy resources (deferred cleanup)
Loading

Poem

In the warren of code, new tests now appear,
YAML and Go bring the cloud ever near.
With fixtures and modules, dependencies set,
The Redis is tested—no bunny will fret!
Old scripts are retired, .gitignore keeps clean,
A hop, a deploy, in the fields evergreen. 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 461cc27 and 2518e61.

📒 Files selected for processing (1)
  • test/.gitignore (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • test/.gitignore
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

mergify bot commented Jun 20, 2025

Important

Do not edit the README.md directly. It's auto-generated from the README.yaml

Please update the README.yaml file instead.

Could you fix it @RoseSecurity? 🙏

@mergify mergify bot added the triage Needs triage label Jun 20, 2025
Copy link

There are no real tests for this component. So we set terratest statuses to successful execution without running any tests

@RoseSecurity RoseSecurity added the wip Work in Progress: Not ready for final review or merge label Jun 20, 2025
@mergify mergify bot removed the wip Work in Progress: Not ready for final review or merge label Jun 20, 2025
@RoseSecurity RoseSecurity marked this pull request as ready for review June 20, 2025 18:16
@RoseSecurity
Copy link
Author

/terratest

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (7)
test/test_suite.yaml (1)

3-3: Avoid static randomidentifier configuration.

Using a hardcoded randomidentifier reduces test isolation and may lead to resource naming collisions across runs. Consider generating this dynamically or injecting via environment.

test/fixtures/stacks/catalog/account-map.yaml (2)

11-22: Remove or clarify commented S3 backend block.

The large commented-out remote_state_backend for Cloud Posse internal use may confuse future readers. If it’s not needed by this team, consider removing it or moving it to a separate “internal” snippet.


23-31: Document required environment variables.

The static backend notes that TEST_ACCOUNT_ID must be set but the README doesn’t mention it. Please call out this requirement in the test documentation or add an explicit env: block.

test/README.md (2)

3-9: Add instructions for required env vars.

You’ve listed Terraform, Atmos, Go, and AWS credentials. The account-map fixture also needs TEST_ACCOUNT_ID exported. Please add a note here to set that environment variable before running tests.


10-15: Link to Atmos CLI docs and version pinning.

Consider specifying a minimum supported Atmos CLI version and linking to its docs so users don’t run into unexplained compatibility issues.

test/fixtures/stacks/catalog/usecase/basic.yaml (1)

7-18: Cross-check var names and defaults.

  • family: valkey8 should match your module’s family variable (e.g., parameter group family).
  • Confirm that omitting ingress_cidr_blocks is acceptable when allow_ingress_from_this_vpc: true.
  • Consider formatting the egress_cidr_blocks list over multiple lines for readability.
test/component_test.go (1)

20-20: Remove unused constant.

The awsRegion constant is declared but never used in the test. Consider removing it to clean up the code.

-	const awsRegion = "us-east-2"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36568ca and d440784.

⛔ Files ignored due to path filters (1)
  • test/go.sum is excluded by !**/*.sum
📒 Files selected for processing (15)
  • src/variables.tf (1 hunks)
  • test/README.md (1 hunks)
  • test/component_test.go (1 hunks)
  • test/fixtures/atmos.yaml (1 hunks)
  • test/fixtures/stacks/catalog/account-map.yaml (1 hunks)
  • test/fixtures/stacks/catalog/dns-delegated.yaml (1 hunks)
  • test/fixtures/stacks/catalog/dns-primary.yaml (1 hunks)
  • test/fixtures/stacks/catalog/usecase/basic.yaml (1 hunks)
  • test/fixtures/stacks/catalog/usecase/disabled.yaml (1 hunks)
  • test/fixtures/stacks/catalog/vpc.yaml (1 hunks)
  • test/fixtures/stacks/orgs/default/test/_defaults.yaml (1 hunks)
  • test/fixtures/stacks/orgs/default/test/tests.yaml (1 hunks)
  • test/fixtures/vendor.yaml (1 hunks)
  • test/go.mod (1 hunks)
  • test/test_suite.yaml (1 hunks)
🧰 Additional context used
🪛 golangci-lint (1.64.8)
test/component_test.go

20-20: const awsRegion is unused

(unused)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (15)
src/variables.tf (1)

31-31: Add default ingress_cidr_blocks is good, but verify empty list handling.

Defaulting ingress_cidr_blocks to [] prevents undefined behavior and aligns with other defaults. Please confirm the module’s security group logic handles an empty list without generating unintended rules.

test/fixtures/stacks/catalog/dns-delegated.yaml (1)

1-10: Fixture structure looks correct.

The DNS delegated stack fixture defines the required component metadata and variables for dns-delegated. All fields appear accurate and valid.

test/fixtures/stacks/catalog/account-map.yaml (2)

1-9: Verify top-level structure and metadata.

The components.terraform.account-map.metadata and vars entries look correct for a static test fixture. Ensure the terraform_workspace and var defaults align with what the tests expect for IAM role lookups.


32-46: Validate static backend coverage.

The static block uses empty maps/lists for all entries. Verify that the account-map IAM-roles module doesn’t require additional fields in this config for the Redis component tests to pass.

test/fixtures/stacks/orgs/default/test/tests.yaml (1)

1-7: Ensure all imported fixtures exist and match paths.

The import: list references orgs/default/test/_defaults, catalog/vpc, catalog/dns-primary, catalog/dns-delegated, catalog/usecase/basic, and catalog/usecase/disabled. Please confirm that each corresponding *.yaml file is present under test/fixtures/stacks/... and that the names match exactly.

test/fixtures/stacks/catalog/dns-primary.yaml (1)

1-10: Confirm variable names against module interface.

The vars block uses domain_names and record_config. Validate that the Terraform module for dns-primary accepts exactly these parameter names (pluralization, types) and that an empty list for record_config is valid.

test/fixtures/stacks/catalog/usecase/basic.yaml (2)

1-3: Top-level keys structure looks good.


4-6: Verify metadata “component: target”.

Most catalog fixtures use metadata.component to identify the module. Confirm that the test runner expects target here to pick the Redis fixture as the test target.

test/fixtures/stacks/catalog/vpc.yaml (1)

1-20: LGTM! Well-structured VPC test fixture.

The VPC configuration is appropriate for testing with cost-conscious settings like disabled NAT gateways and a reasonable CIDR block. The inline comment explaining the private subnet configuration is helpful for maintainability.

test/fixtures/vendor.yaml (1)

1-55: LGTM! Proper vendor configuration for test dependencies.

The Atmos vendor configuration correctly defines all necessary component dependencies with appropriate version pinning and file inclusion patterns. The use of CloudPosse's official repositories ensures reliable component sources.

test/component_test.go (3)

17-50: Excellent test implementation with comprehensive coverage.

The TestBasic method provides thorough testing of the ElastiCache Redis component with:

  • Proper unique naming to avoid conflicts
  • Comprehensive Redis cluster configuration using Valkey engine
  • Appropriate instance type and parameters for testing
  • Proper cleanup with deferred destruction
  • Drift testing to ensure component stability

52-56: Good coverage of the enabled flag functionality.

The TestEnabledFlag method properly tests the disabled component behavior, ensuring no resources are created when the component is disabled.


58-76: Well-structured test suite setup with proper dependency management.

The TestRunSuite function correctly:

  • Initializes the test suite
  • Adds VPC dependency without custom inputs
  • Generates unique DNS subdomain to avoid conflicts
  • Adds DNS-delegated dependency with proper zone configuration
  • Runs the complete test suite
test/fixtures/stacks/orgs/default/test/_defaults.yaml (1)

1-67: LGTM! Comprehensive test stack defaults configuration.

The configuration provides a solid foundation for testing with:

  • Appropriate local backend for test isolation
  • Flexible environment variable usage for account ID
  • Comprehensive account-map static configuration
  • Proper label ordering and naming conventions
  • Well-structured descriptor formats for consistent naming
test/fixtures/atmos.yaml (1)

1-78: Excellent Atmos configuration with comprehensive settings.

This configuration file provides a robust foundation for the test environment with:

  • Clear documentation of configuration loading hierarchy
  • Comprehensive Terraform component settings with appropriate defaults
  • Proper stack configuration with glob patterns for test organization
  • Flexible environment variable overrides throughout
  • Template support enabling advanced configuration capabilities

The configuration is well-structured and thoroughly documented, making it easy to understand and maintain.

enabled: false
family: valkey8
allow_ingress_from_this_vpc: true
egress_cidr_blocks: ["0.0.0.0/0"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Undefined variable egress_cidr_blocks.

This fixture references egress_cidr_blocks, but the module’s variables.tf does not declare it. Confirm if this is intentional or add the corresponding variable for explicit egress block configuration.

🤖 Prompt for AI Agents
In test/fixtures/stacks/catalog/usecase/disabled.yaml at line 10, the variable
egress_cidr_blocks is used but not declared in the module's variables.tf file.
To fix this, add a variable declaration for egress_cidr_blocks in variables.tf
with an appropriate type and default value or description to explicitly define
this variable for egress block configuration.

@mergify mergify bot added the needs-test Needs testing label Jun 23, 2025
@RoseSecurity
Copy link
Author

/terratest

@RoseSecurity
Copy link
Author

@goruha Is there a good way to trigger these in the pipeline as these tests fail locally for the hosted zone lookup?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/component_test.go (1)

20-20: Remove unused constant.

The awsRegion constant is defined but never used in the test.

-	const awsRegion = "us-east-2"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d440784 and 8e308d2.

📒 Files selected for processing (3)
  • test/component_test.go (1 hunks)
  • test/fixtures/stacks/orgs/default/test/tests.yaml (1 hunks)
  • test/fixtures/vendor.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/fixtures/vendor.yaml
  • test/fixtures/stacks/orgs/default/test/tests.yaml
🧰 Additional context used
🪛 golangci-lint (1.64.8)
test/component_test.go

20-20: const awsRegion is unused

(unused)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (5)
test/component_test.go (5)

1-11: LGTM! Well-structured imports for component testing.

The package structure and imports are appropriate for a Terraform component test using Atmos and terratest frameworks.


13-15: LGTM! Clean test suite structure.

The ComponentSuite struct properly embeds the helper.TestSuite, following standard Go testing patterns.


17-19: LGTM! Comprehensive basic component test.

The test properly:

  • Sets up unique identifiers to avoid conflicts
  • Configures ElastiCache Redis with Valkey engine
  • Ensures cleanup with deferred destruction
  • Validates deployment and runs drift testing

The configuration covers essential parameters including engine version, instance type, and extended Redis compatibility.

Also applies to: 21-50


52-56: LGTM! Important enabled flag validation.

This test ensures that no resources are created when the component is disabled, which is crucial for cost control and resource management.


58-76: LGTM! Proper test suite setup with dependency management.

The test suite correctly:

  • Sets up required infrastructure dependencies (VPC and DNS)
  • Creates unique identifiers to avoid test conflicts
  • Uses appropriate test environment configuration
  • Follows proper test initialization patterns

The hardcoded zone name appears intentional for the controlled test environment.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/component_test.go (1)

20-20: Remove unused constant.

The awsRegion constant is defined but never used in the code.

-	const awsRegion = "us-east-2"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d440784 and 8e308d2.

📒 Files selected for processing (3)
  • test/component_test.go (1 hunks)
  • test/fixtures/stacks/orgs/default/test/tests.yaml (1 hunks)
  • test/fixtures/vendor.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/fixtures/vendor.yaml
  • test/fixtures/stacks/orgs/default/test/tests.yaml
🧰 Additional context used
🪛 golangci-lint (1.64.8)
test/component_test.go

20-20: const awsRegion is unused

(unused)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (5)
test/component_test.go (5)

1-11: LGTM! Clean package structure and appropriate imports.

The package declaration and imports are well-organized and appropriate for the testing requirements. The external dependencies (test-helpers, terratest, testify) are standard choices for infrastructure testing.


13-15: LGTM! Proper test suite embedding pattern.

The ComponentSuite struct correctly embeds the helper.TestSuite, following the established pattern for component testing.


17-50: LGTM! Well-structured test with proper cleanup and validation.

The TestBasic method demonstrates good testing practices:

  • Uses unique identifiers to avoid conflicts
  • Properly structured configuration inputs for Valkey engine
  • Includes cleanup via defer statement
  • Validates deployment success and runs drift testing

The configuration parameters are appropriate for testing Valkey compatibility with Redis.


52-56: LGTM! Concise and focused test.

The TestEnabledFlag method correctly tests the disabled component behavior using the helper's VerifyEnabledFlag method.


58-76: LGTM! Proper test suite setup with dependencies.

The TestRunSuite function correctly:

  • Initializes the test suite
  • Adds required dependencies (vpc and dns-delegated) with appropriate configurations
  • Uses unique subdomain generation to avoid conflicts
  • Properly orchestrates the test execution

The dependency setup ensures the required infrastructure components are available for the ElastiCache Redis tests.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
test/component_test.go (3)

20-20: Remove unused constant awsRegion.

The awsRegion constant is defined but never used in the test method.

-	const awsRegion = "us-east-2"

22-33: Consider making engine configuration more flexible.

The engine is hardcoded as "valkey" but the test is for an "elasticache-redis" component. While Valkey is Redis-compatible, consider parameterizing the engine choice or adding a comment explaining the intentional use of Valkey.

+	// Using Valkey engine (Redis-compatible) for testing
 	engineName := "valkey"

68-68: Consider parameterizing the hardcoded DNS zone.

The DNS zone name is hardcoded which may limit test portability across different environments.

Consider adding this as a constant or making it configurable:

+	const testDNSZone = "components.cptest.test-automation.app"
+
 	inputs := map[string]any{
 		"zone_config": []map[string]any{
 			{
 				"subdomain": subdomain,
-				"zone_name": "components.cptest.test-automation.app",
+				"zone_name": testDNSZone,
 			},
 		},
 	}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d440784 and 8e308d2.

📒 Files selected for processing (3)
  • test/component_test.go (1 hunks)
  • test/fixtures/stacks/orgs/default/test/tests.yaml (1 hunks)
  • test/fixtures/vendor.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/fixtures/stacks/orgs/default/test/tests.yaml
  • test/fixtures/vendor.yaml
🧰 Additional context used
🪛 golangci-lint (1.64.8)
test/component_test.go

20-20: const awsRegion is unused

(unused)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (6)
test/component_test.go (6)

1-11: LGTM! Clean import structure.

The package declaration and imports are well-organized and appropriate for a component test file. All imported packages serve clear purposes in the testing implementation.


13-15: LGTM! Proper test suite composition.

The ComponentSuite struct correctly embeds the TestSuite from the helper package, following Go composition patterns for extending functionality.


25-43: LGTM! Well-structured test inputs.

The test inputs are properly structured with unique naming and realistic configuration parameters. The use of random.UniqueId() prevents test conflicts and the Redis cluster configuration is appropriate for testing.


45-50: LGTM! Proper test lifecycle management.

Excellent use of defer for cleanup and the drift test ensures the component remains stable across multiple applies. The assertion on options validates successful deployment.


52-56: LGTM! Concise enabled flag test.

The test properly verifies that the component respects the enabled flag, which is crucial for conditional resource creation.


58-76: LGTM! Well-organized test suite setup.

The test suite properly manages dependencies with unique inputs to prevent conflicts. The use of random subdomains and proper dependency ordering demonstrates good testing practices.

@goruha
Copy link
Contributor

goruha commented Jun 24, 2025

@goruha Is there a good way to trigger these in the pipeline as these tests fail locally for the hosted zone lookup?

yes.

@goruha
Copy link
Contributor

goruha commented Jun 24, 2025

@goruha
Copy link
Contributor

goruha commented Jun 24, 2025

/terratest

@goruha
Copy link
Contributor

goruha commented Jun 24, 2025

@RoseSecurity
Copy link
Author

Awesome, thank you for this!

@RoseSecurity
Copy link
Author

/terratest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-test Needs testing triage Needs triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants